package logic

import (
	"context"
	"jd-mall/jd/models"

	"jd-mall/jd/internal/svc"
	"jd-mall/jd/jd"

	"github.com/zeromicro/go-zero/core/logx"
)

type ShopShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewShopShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShopShowLogic {
	return &ShopShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *ShopShowLogic) ShopShow(in *jd.ShopShowRequest) (*jd.ShopShowResponse, error) {
	// todo: add your logic here and delete this line
	var s models.Shop
	models.DB.Debug().Where("id =?", in.GoodsId).Find(&s)
	return &jd.ShopShowResponse{
		Title:  s.Title,
		Price:  s.Price,
		Num:    int64(s.Num),
		Status: int64(s.Status),
	}, nil
}
